package com.jiyun.trainlist.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiyun.model.Train;
import com.jiyun.vo.TrainVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TrainMapper extends BaseMapper<Train> {
    Page<TrainVo> findPage(Page<TrainVo> trainVoPage,@Param("tr") TrainVo trainVo);

    @Select("select t.*,t.starttime tstarttime,t.endtime tendtime,t.num tnum,c.num cnum,l.lname lname from train t,course c,label l where t.cid=c.id and t.lid=l.id and t.id=#{value}")
    List<TrainVo> findPeopleandTime(Integer id);

    @Select("update train set status='已完成' where id=#{value}")
    void goCanjia(Integer id);
}
